package com.ailang.aiskand.adapter

import android.graphics.Typeface
import android.view.Gravity
import com.ailang.aiskand.bean.AiChatBean
import com.ailang.aiskand.bean.Role
import com.ailang.aiskand.databinding.LayoutAichatItemBinding
import com.hzjh.base.frame.adapter.BaseBindingVH

class AiChatAdapter(binding:LayoutAichatItemBinding)
    :BaseBindingVH<AiChatBean,LayoutAichatItemBinding>(binding) {
    override fun onBind(model: AiChatBean, position: Int) {
        if(model.role==Role.user){
            binding.tvContentItem.gravity=Gravity.END
            binding.tvContentItem.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
        }else{
            binding.tvContentItem.gravity=Gravity.START
            binding.tvContentItem.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
        }
        binding.tvContentItem.text=model.text
    }
}